# -*- coding: utf8 -*-
from kivy import Logger
from kivy.core.window import Window

import os

from kivy.app import App
from kivy.resources import resource_add_path

from EasyLangLearnWindow import EasyLangLearnWindow
from EasyLangLearnWidgets import MessageBox, HSeparator, VSeparator
from EasyLangLearnInput import EasyLangLearnInputGroup


class EasyLangLearnApp(App):
	learn_window = None

	def __init__(self, path, **kwargs):
		super(EasyLangLearnApp, self).__init__(**kwargs)

		self. path = path

	def build(self):
		resource_add_path(self.path+"Images")

		self.learn_window = EasyLangLearnWindow(self.path)

		Window.bind(on_keyboard=self.hook_keyboard)

		return self.learn_window

	def hook_keyboard(self, window, key, *largs):
		#ако е натиснат бутона назад / ESC
		if key == 27:
			Logger.info("BACK PRESSED")

			return self.learn_window.go_prev()

